<template>
  <Transition name="fade">
    <div
      v-if="show"
      class="modal fixed w-full h-full z-100 top-0 left-0 bg-black bg-opacity-30 flex items-center transition-all"
    >
      <div class="w-80 h-30 m-auto bg-white border shadow-lg rounded-2 px-4 py-6">
        <slot></slot>
        <div class="flex justify-end pt-4">
          <div class="btn" @click="show = false">取消</div>
          <div class="btn-plain ml-2" @click="handleConfirm">确定</div>
        </div>
      </div>
    </div>
  </Transition>
</template>

<script setup lang="ts">
const show = defineModel({ default: false })
const emits = defineEmits<{
  'on-confirm': []
}>()

const handleConfirm = () => {
  show.value = false
  emits('on-confirm')
}
</script>

<style scoped lang="scss">
.fade-enter-from,
.fade-leave-to {
  opacity: 0;
}
</style>
